﻿using System.Collections.Generic;
using System.Text;

namespace tiny_compiler
{
	public class Value :
		IOperator
	{
		public Value(string _name, string _value)
		{
			m_name = _name;
			m_value = _value;

			m_length = m_value.Length;
			for (int index = 0; index < m_value.Length; index ++)
			{
				if (m_value[index] == '\\' && m_value[index + 1] == 'n')
				{
					m_length--;
					index++;
				}
			}
		}

		#region IOperator Members

		public int Length
		{
			get { return m_length; }
		}

		public string Name
		{
			get { return m_name; }
		}

		public void Resolve(IEnumerable<IOperator> _operators)
		{
		}

		public void Append(StringBuilder _data)
		{
			_data.Append(m_value);
		}

		#endregion

		private string m_name;
		private string m_value;
		private int m_length;
	}
}
